package com.shunhe.zs_pda.base

import android.os.Bundle
import android.view.View
import android.widget.TextView
import com.ruitu.arad.base.BaseActivity
import com.ruitu.arad.base.BaseModel
import com.ruitu.arad.base.BasePresenter
import com.shunhe.zs_pda.R
import me.dkzwm.widget.srl.SmoothRefreshLayout

//abstract class Base2Activity<P : BasePresenter<*, *>?, M : BaseModel> : BaseActivity<P, M>() {
abstract class Base2Activity : BaseActivity<BasePresenter<*, *>?, BaseModel>() {
    protected var tv_empty: TextView? = null
    var refreshLayout: SmoothRefreshLayout? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        tv_empty = findViewById(R.id.tv_empty)
    }

    // 是否展示空白布局
    protected fun showEmpty(isShow: Boolean) {
        if (null != tv_empty) {
            tv_empty!!.visibility = if (isShow) View.VISIBLE else View.GONE
        }
    }

    // 根据数据判断是否显示空白布局
    protected fun showEmpty(data: ArrayList<*>?) {
        showEmpty(isDataEmpty(data))
    }

    override fun hideProgress() {
        super.hideProgress()
        refreshLayout?.refreshComplete()
    }

}